<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2020/10/20
 * Time: 14:29
 */

namespace app\adminapiv3\validate;


use think\Validate;

class SoftwareValidate extends Validate
{
    //验证规则
    protected $rule = [
        'id' => 'require',
        'name|业务系统名称' => 'require|max:33',
        'status|业务系统状态' => 'require|in:1,2',
        'description|功能说明' => 'require|max:366',
        'on_time|上线时间' => 'require|date',
        'off_time|退役时间' => 'require',
    ];

    //错误信息
    protected $message = [
        'status.require' => '请选择业务系统状态',
        'status.in' => '业务系统状态必须是使用中或已退役'
    ];

    //验证场景
    protected $scene = [
        //添加
        'add' => ['name','on_time','description'],
        //修改
        'modify' => ['id','name','on_time','description','status'],
        //删除
        'del' => ['id'],
        //退役
        'retire' => ['id'],
    ];


}